package mo.leetcode_top;

public class L326 {

    public boolean isPowerOfThree(int n) {

        while (n != 0 && n % 3 == 0) {
            n = n / 3;
        }

        return n == 1;
    }

}
